import { request } from '@boeyo/portal';

/**
 * 地震触发列表
 * null
 */
export const projectQuickReportList = (params) => {
  return request({
    url: '/projectQuickReport/list',
    method: 'GET',
    params,
  });
};

/**
 * 获取地震触发配置
 * null
 */
export const getInfo = (params?) => {
  return request({
    url: '/earthquakeTriggerConfig/getInfo',
    method: 'GET',
    params,
  });
};

/**
 * 更新地震触发配置
 * null
 */
export const update = (data) => {
  return request({
    url: '/earthquakeTriggerConfig/update',
    method: 'PUT',
    data,
  });
};

/**
 * 删除
 * @ss.hasPermi('powerSupply:remove')
 */
export const delProjectQuickReport = (ids) => {
  return request({
    url: `/projectQuickReport/${ids}`,
    method: 'DELETE',
  });
};

/**
 * 历史数据波形
 */
export const fetchHistoryData = (params) => {
  return request({
    url: 'deviceData/history',
    params,
    skipError: true,
  });
};

/**
 * 指定路径文件下载
 * null
 */
export const downloadFile = (params) => {
  return request({
    url: '/fileDownload/downloadFile',
    responseType: 'blob',
    method: 'GET',
    params,
  });
};

/**
 * 报告产出文件下载
 * null
 */
export const downloadGenerateById = (generateId, docType = 'pdf') => {
  return request({
    url: `/produce/downloadGenerateById/${generateId}/${docType}`,
    method: 'GET',
    responseType: 'blob',
    closeDownload: true,
  });
};

/**
 * 生成地震速报报告
 * null
 */
export const createEarthquakeData = (id) => {
  return request({
    url: `/produce/createEarthquakeData/${id}`,
    method: 'GET',
    skipError: true,
  });
};

/**
 * 傅立叶谱
 * null
 */
export const signal = (data) => {
  return request({
    url: `/deviceData/signal`,
    method: 'post',
    data,
  });
};

/**
 * 反应谱
 * null
 */
export const responseSpectrum = (data) => {
  return request({
    url: `/deviceData/responseSpectrum`,
    method: 'post',
    data,
  });
};

/**
 * 烈度
 * null
 */
export const intensity = (data) => {
  return request({
    url: '/projectQuickReport/intensity',
    method: 'POST',
    data,
  });
};
